/**
 * Relicates a String
 */
public class Replicate {

    public static void main(String[] args) {
        testString("hello");
        testString("z");
        testString("");
    }
    public static void testString(String str) {
        System.out.println("Testing string \"" + str + "\":");
        System.out.println(" -1: \"" + repl(str, -1) + "\"");
        System.out.println("  0: \"" + repl(str, 0) + "\"");
        System.out.println("  1: \"" + repl(str, 1) + "\"");
        System.out.println("  3: \"" + repl(str, 3) + "\"");
        System.out.println("  5: \"" + repl(str, 5) + "\"");
    }


    // --------------------------------
    // ----- ENTER YOUR CODE HERE -----
    // --------------------------------

    public static String repl(String str, int x) {
        String output = "";
        if (x <= 0) {
            output = "";
        }
        else {
            for (int i = 1; i <= x; i++) {
                output = output + str;
            }
        }
        return output;
    }
            
    // --------------------------------
    // --------- END USER CODE --------
    // --------------------------------


}


              